<?php
$this->breadcrumbs=array();

$this->sidebarTop = array(
    'label' => Yii::t('BackEnd', "System"),
    'link' => "#"
);

$this->moduleName = "EmailTemplate";
$this->menu=array(
	array('label'=>Yii::t('BackEnd', 'List'), 'url'=>array('admin')),
);

$this->slidebar = Backend::getModuleSlideBar('Setting', '/emailTemplate/admin');

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('email-template-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
$this->title = Yii::t('BackEnd', "Manage email templates");
?>

<div class="search-form">
<?php $this->renderPartial('_search',array(
	'model'=>$model,
)); ?>
</div><!-- search-form -->
<!--Use for ajax link-->
<input type="hidden" id="moduleName" value="emailTemplate"/>
<?php $this->widget('application.widgets.admin.GridView', array(
	'id'=>'email-template-grid',
	'dataProvider'=>$model->search(),
	'columns'=>array(
		'id',
        array(
            'name' => 'code',
            'header' => Yii::t('BackEnd', 'Code'),
            'type' => 'raw',
            'htmlOptions' => array('style'=>'text-align: left;'),
            ),
        array(
            'name' => 'title',
            'header' => Yii::t('BackEnd', 'Title'),
            'type' => 'raw',
            'htmlOptions' => array('style'=>'text-align: left;'),
            ),
        array(
            'name' => 'subject',
            'header' => Yii::t('BackEnd', 'Subject'),
            'type' => 'raw',
            'htmlOptions' => array('style'=>'text-align: left;'),
            ),
//        array(
//            'name' => 'body',
//            'type' => 'html',
//            'value' => '$data->body',
//        ),
		'from',
		array(
            'name' => 'status',
            'type' => 'raw',
            'value' => '($data->status == Lvc::STATUS_ENABLED)?CHtml::image(Yii::app()->request->baseUrl."/css/admin/images/tick.png", "enabled", array("class"=>"icon-status", "name"=>$data->id)):CHtml::image(Yii::app()->request->baseUrl."/css/admin/images/publish_x.png", "disabled", array("class"=>"icon-status", "name"=>$data->id))',
            'htmlOptions' => array('style'=>'text-align: center;'),
        ),
		array(
			'class'=>'CButtonColumn',
            'deleteButtonOptions'=>array('style'=>'visibility:hidden;'),
            'header'=> Yii::t('BackEnd', 'Actions'),
            'viewButtonImageUrl'=> Yii::app()->request->baseUrl.'/css/admin/images/page-view.png',
            'updateButtonImageUrl'=> Yii::app()->request->baseUrl.'/css/admin/images/page-edit.png',
            ),
	),
)); ?>